package com.ourteam.datawarehouse.domain;
/**
 * Template Name : DTO数据对象 Template Version : 1 Template Last Modfiy Date : Fri Nov 30 16:49:33 CST
 * 2018 Auto Generate Date : 2019-02-13 11:54:30 Warning ! This file will be overwrite when
 * regenerate !
 */
import java.util.HashMap;
import java.util.Map;
import net.dao.IDataPopulateCallback;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.lang.ArrayUtils;

public class DataSourceBean implements java.io.Serializable {

  private static Map<String, String> mappedDaoFields = new HashMap<String, String>();

  private com.ourteam.datawarehouse.dao.DataSource dataSource;

  protected BeanMap getBeanMap() {

    return new BeanMap(dataSource);
  }

  static {
    mappedDaoFields.put("id", com.ourteam.datawarehouse.dao.IDataSourceDAO.Id);

    mappedDaoFields.put(
        "dataSourceType", com.ourteam.datawarehouse.dao.IDataSourceDAO.DataSourceType);

    mappedDaoFields.put(
        "dataSourceCode", com.ourteam.datawarehouse.dao.IDataSourceDAO.DataSourceCode);

    mappedDaoFields.put(
        "dataSourceUrl", com.ourteam.datawarehouse.dao.IDataSourceDAO.DataSourceUrl);

    mappedDaoFields.put(
        "dataSourceAccount", com.ourteam.datawarehouse.dao.IDataSourceDAO.DataSourceAccount);

    mappedDaoFields.put(
        "dataSourcePassword", com.ourteam.datawarehouse.dao.IDataSourceDAO.DataSourcePassword);

    mappedDaoFields.put("status", com.ourteam.datawarehouse.dao.IDataSourceDAO.Status);

    mappedDaoFields.put("remarks", com.ourteam.datawarehouse.dao.IDataSourceDAO.Remarks);
  }

  public static String getMappedDAOField(String aAttrName) {
    return mappedDaoFields.get(aAttrName);
  }

  public DataSourceBean() {
    super();

    this.dataSource = new com.ourteam.datawarehouse.dao.DataSource();
  }

  public DataSourceBean(com.ourteam.datawarehouse.dao.DataSource dataSource) {
    super();

    this.dataSource = dataSource;
  }

  public com.ourteam.datawarehouse.dao.DataSource convertToDataSource() {
    return this.dataSource;
  }

  public com.ourteam.datawarehouse.dao.DataSource convertTo() {
    return this.dataSource;
  }

  /**
   * Get id
   *
   * @return long
   */
  public long getId() {
    return (long) this.dataSource.getId();
  }

  /**
   * Set id
   *
   * @parameter long
   */
  public void setId(long id) {

    this.dataSource.setId(id);
  }

  /**
   * Get dataSourceType
   *
   * @return String
   */
  public String getDataSourceType() {
    return (String) this.dataSource.getDataSourceType();
  }

  /**
   * Set dataSourceType
   *
   * @parameter String
   */
  public void setDataSourceType(String dataSourceType) {

    this.dataSource.setDataSourceType(dataSourceType);
  }

  /**
   * Get dataSourceCode
   *
   * @return String
   */
  public String getDataSourceCode() {
    return (String) this.dataSource.getDataSourceCode();
  }

  /**
   * Set dataSourceCode
   *
   * @parameter String
   */
  public void setDataSourceCode(String dataSourceCode) {

    this.dataSource.setDataSourceCode(dataSourceCode);
  }

  /**
   * Get dataSourceUrl
   *
   * @return String
   */
  public String getDataSourceUrl() {
    return (String) this.dataSource.getDataSourceUrl();
  }

  /**
   * Set dataSourceUrl
   *
   * @parameter String
   */
  public void setDataSourceUrl(String dataSourceUrl) {

    this.dataSource.setDataSourceUrl(dataSourceUrl);
  }

  /**
   * Get dataSourceAccount
   *
   * @return String
   */
  public String getDataSourceAccount() {
    return (String) this.dataSource.getDataSourceAccount();
  }

  /**
   * Set dataSourceAccount
   *
   * @parameter String
   */
  public void setDataSourceAccount(String dataSourceAccount) {

    this.dataSource.setDataSourceAccount(dataSourceAccount);
  }

  /**
   * Get dataSourcePassword
   *
   * @return String
   */
  public String getDataSourcePassword() {
    return (String) this.dataSource.getDataSourcePassword();
  }

  /**
   * Set dataSourcePassword
   *
   * @parameter String
   */
  public void setDataSourcePassword(String dataSourcePassword) {

    this.dataSource.setDataSourcePassword(dataSourcePassword);
  }

  /**
   * Get status
   *
   * @return String
   */
  public String getStatus() {
    return (String) this.dataSource.getStatus();
  }

  /**
   * Set status
   *
   * @parameter String
   */
  public void setStatus(String status) {

    this.dataSource.setStatus(status);
  }

  /**
   * Get remarks
   *
   * @return String
   */
  public String getRemarks() {
    return (String) this.dataSource.getRemarks();
  }

  /**
   * Set remarks
   *
   * @parameter String
   */
  public void setRemarks(String remarks) {

    this.dataSource.setRemarks(remarks);
  }

  public int hashCode() {
    return org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(this);
  }

  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    } // end if

    if ((obj instanceof DataSourceBean) == false) {
      return false;
    } // end if

    DataSourceBean other = (DataSourceBean) obj;

    boolean isEqual = false;

    com.ourteam.datawarehouse.dao.DataSource tempDataSource = other.convertToDataSource();

    if (tempDataSource == null || this.dataSource == null) {
      isEqual = false;
    } else if (tempDataSource == this.dataSource || tempDataSource.equals(this.dataSource)) {
      isEqual = true;
    } else {
      isEqual = false;
    }

    return isEqual;
  }

  public static DataSourceBean[] toArray(com.ourteam.datawarehouse.dao.DataSource[] aDataSources) {

    return toArray(aDataSources, null);
  }

  public static DataSourceBean[] toArray(
      com.ourteam.datawarehouse.dao.DataSource[] aDataSources, IDataPopulateCallback aCallBack) {

    if (ArrayUtils.isEmpty(aDataSources)) {
      return new DataSourceBean[0];
    }

    int length = aDataSources.length;

    DataSourceBean[] beans = new DataSourceBean[length];

    for (int i = 0; i < length; i++) {
      beans[i] = new DataSourceBean(aDataSources[i]);
      if (aCallBack != null) {
        aCallBack.populate(beans[i], new Object[] {aDataSources[i]});
      }
    }

    return beans;
  }
}
